// 按路由拆分代码
import Loadable from 'react-loadable';

export default (Component) => {
    Loadable({
            // loader: () => import(Component),
            loader: () => Component,
            loading : LoadingComponent
    })
}

const LoadingComponent = ({ isLoading, error }) => {
        // Handle the loading state
    if (isLoading) {
        return <div>Loading...</div>;
    }
    // Handle the error state
    else if (error) {
        return <div>Sorry, there was a problem loading the page.</div>;
    }
    else {
        return null;
    }
}; 